package db;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;

public class SQL {
	
	public static Map map = new HashMap();
	
	static {
		try {
			File file = null;
			if (System.getProperty("user.home").equals(DataUtils.bundle.getString("USERHOME"))) {
				file = new File(DataUtils.bundle.getString("osxPath"));
			} else {
				file = new File(DataUtils.bundle.getString("sqlPath"));
			}
			
			File[] files = file.listFiles();
			
			for (int i = 0; i < files.length; i++) {
				if (!files[i].isFile()) {
					continue;
				}
				if (!files[i].getAbsolutePath().endsWith(".sql")) {
					continue;
				}
				String sql = "";
				String line = "";
				BufferedReader br = new BufferedReader(new FileReader(files[i]));
				while ((line = br.readLine()) != null) {
					sql += line + " ";
				}
				br.close();
				map.put(files[i].getName(), sql);
			}
			
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
}
